﻿using MeterReader.WebApi.Models;
using MeterReader.WebApi.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace MeterReader.WebApi.Controllers
{
    [Route("[controller]/[action]")]
    [ApiController]
    public class HistoryController : ControllerBase
    {
        private readonly IDataService _dataService;

        public HistoryController(IDataService dataService)
        {
            _dataService = dataService;
        }

        [HttpGet]
        public async Task<List<string>> GetMeterList()
        {
            var a = await _dataService.GetMeterList();
            return a;
        }

        [HttpGet]
        public async Task<List<PointsInfo>> SearchHistory(string name, DateTime start, DateTime end)
        {
            return await _dataService.SearchHistory(name, start, end);
        }
    }
}
